import { defineStore } from "pinia";

export const useMainStore = defineStore({
  id: "main",
  state: () => ({
    isSignIn: false,
    isLoading: false,
    loadingMsg: '',
    showModal: false,
    user: {
      uid: '',
      displayName: '',
      email: '',
    },
    features: [],
  }),
  actions: {
    setUser({ uid, displayName, email }) {
      this.user.uid = uid;
      this.user.displayName = displayName;
      this.user.email = email;
    },
    setSignInStatus(status) {
      this.isSignIn = status;
    },
    setLoadingStatus(status) {
      this.isLoading = status;
    },
    setFeatures(features) {
      this.features = features;
    },
    setModalStatus(status) {
      this.showModal = status;
    },
    setLoadingMsg(msg) {
      this.loadingMsg = msg;
    },
  }
});